#!/bin/sh
#Esperamos hasta que se haya completado el arranque
while ! test -f /var/run/runlevel; do
	sleep 1
done

TFILE="/media/testdrive/result.txt"

echo "----- STARTING TEST -----"
echo " EXECUTING TEST IN `pwd`" > $TFILE

lsmod >> $TFILE
echo >> $TFILE
RES=`lsmod | wc -l`
if test "$RES" -ne 1 ; then
	ls /mnt/ >> $TFILE
	echo >> $TFILE
	if /usr/local/opendomo/services/config/saveSystemConfiguration.sh >> $TFILE
	then
		if /usr/local/opendomo/loadSystemConfiguration.sh >> $TFILE
		then
			echo "OK" >> $TFILE
		else
			echo "FAILED" >> $TFILE
		fi
	else
		echo "FAILED" >> $TFILE
	fi
else
	echo "FAILED" >> $TFILE
fi
reboot
